package com.my.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.my.demo.service.UserService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
//偶尔进行测试的接口
public class Test {
  @Autowired
  UserService userService;
  @RequestMapping("/test")
  public Object test() {
    String userName = (String) SecurityUtils.getSubject().getPrincipal();
    Integer userId = userService.selectIdByName(userName);


    return  userId;
  }
}
